package com.xk.Reflect.exercise;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class studentFactory {
    public static Student GetStudentInfo(String info) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<?> stu1=Class.forName("com.xk.Reflect.exercise."+info);
        Constructor<?> constructor=stu1.getConstructor();
        return (Student) constructor.newInstance();
    }
}
